import request from "@/utils/request";
import { ref } from "vue";

//  通用接口
export async function fetchApiGET(url, params) {
  const data = ref({});

  return [data, () => fetchGET(data, url, params)];
}

async function fetchGET(data, url, params) {
  data.value = await request.get(url, params);
}


export async function fetchApiPOST(url, params = {}) {
  const data = ref({});
  return [data, () => fetchPOST(data, url, params)];
}

async function fetchPOST(data, url, params) {
  data.value = await request.post(url, params);
}
